<template>
  <el-card class="page-container">
    <template #header>
      <div class="header">
        <!-- 页面标题 -->
        <span><h1>{{ title }}</h1></span>
        <div class="extra">
          <!-- 具名插槽 位于页面右上角区域 -->
          <slot name="extra"></slot>
        </div>
      </div>
    </template>
    <!-- 内容插槽 页面的元素都会展示展示在这 -->
    <slot></slot>
  </el-card>
</template>

<script>
export default {
  name: 'PageContainer', // 页面容器组件
  props: {
    title: {
      required: true,
      type: String
    }
  }
}
</script>

<style lang="scss" scoped>
.page-container {
  min-height: 100%;
  box-sizing: border-box;

  .header {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
}
</style>
